#pragma once
/*!
* \file  ui_button.h
* \brief button
* 
*
* 
* \author patdz@qq.com
* \version 1.0
* \date 2014/06/11
*/
#include "ui_control.h"
#include "ui_focusable_control.h"

_SSL_BEGIN
_SSUIL_BEGIN

#pragma warning(push)
#pragma warning(disable:4250)

class UIButton :
	public UIFocusableControl
{
public:
	UIButton();
	virtual ~UIButton();

	//
public:
	virtual bool ApplyAttributes(IUIBuilderInterface *ui_builder, 
		IUIXMLDocumentInterface *xml_document, UIXmlNode node);
	virtual void AfterBuild(IUIBuilderInterface *ui_builder,
		IUIXMLDocumentInterface *xml_document, UIXmlNode node);
	virtual void OnStateChangedCB();
	virtual HCURSOR GetCursor();

	//
public:
	void SetText(const tstring &text);
	tstring GetText();

	void SetLabel(IUIControlInterface *label);
	void SetDisabledLabel(IUIControlInterface *label);
	void SetOveredLabel(IUIControlInterface *label);
	void SetPressedLabel(IUIControlInterface *label);
	void SetFocusedLabel(IUIControlInterface *label);
	void SetFocusedPressedLabel(IUIControlInterface *label);
	void SetFocusedOveredLabel(IUIControlInterface *label);

protected:
	void ApplyTextOnLabel(IUIControlInterface *label);;

protected:
	tstring text_;
	weak_ptr<IUIControlInterface> label_;
	weak_ptr<IUIControlInterface> disabled_label_;
	weak_ptr<IUIControlInterface> overed_label_;
	weak_ptr<IUIControlInterface> pressed_label_;
	weak_ptr<IUIControlInterface> focused_label_;
	weak_ptr<IUIControlInterface> focused_pressed_label_;
	weak_ptr<IUIControlInterface> focused_overed_label_;
	weak_ptr<IUIControlInterface> active_label_;
};

#pragma warning(pop)

_SSUIL_END
_SSL_END

